<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        $(function () {
/*          var $div = $('div');
            $div.css({'background-color':"gold"}); */

            //只用一次的情况 
            $('div').css({'background-color':"gold"});

            $('div').has('p').eq(1).css({'font-size':'20px'});

            $('div').eq(4).prev().css({'text-indent':'40px','color':'red'});

           $('div').find('.tip').css({'color':"blue", 'font-size':'30px'});

        })
    
    
    </script>
    <title>Document</title>
</head>
<body>
    <div>1</div>
    <div>
        <p>2</p>
    </div>
    <div>3</div>
    <div><p>4</p></div>
    <div>5</div>
    <div>6</div>
    <div>7</div>
    <div><span>8</span><span class="tip">9</span>
           
    </div>

</body>
</html>